var xmlHttp;
var userid;
function create(){
	if(window.XMLHttpRequset){
		xmlHttp = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function loginrun(){
	create();
	var namevalue = document.getElementById("uname").value;
	var pwdvalue = document.getElementById("pwd").value;
	userid = namevalue;
	//var URL = "/ajax/servlet/ajax?name="+value;
	url = "AdminLoginServlet.do?uname="+namevalue+"&pwd=" + pwdvalue;
	
	
	$.ajax({
		type:"post",
		url:url,
		dataType:"html",
		cache:false,
		success:function call(v){
		   if( v == "login-false" ){
				alert("Wrong Username Or Password, Type Again" );
				window.location.reload();
			}else if(v == "login-succes"){
				//window.location.href ="AdminMainSerlvet.do?userid=" + userid + "&aa=" + Math.random();
				window.location.href ="main.jsp?&aa=" + Math.random();
			}
		},
		error:function errorcall(){
			alert("no!");
		}
	});
	
}

